import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from "../components/Login";
import Main from "../views/Main";
import UserManage from "../views/UserManage";
import Dish from "../views/Dish";
import Employee from "../views/Employee";
import Operate from "../views/Operate";
import Order from "../views/Order";
import Role from "../views/Role";
import Welcome from "@/views/Welcome";
Vue.use(VueRouter)

const routes = [
      {
        path:"/",
        redirect:"/login"
      },
      {
        name:'login',
        path:"/login",
        component:Login
      },
      {
        name: "main",
        path: "/main",
        component: Main,
        children:[
            {
               name:'userManage',
               path:'/users',
               component:UserManage
            },
            {
                name:"dish",
                path: "/dishes",
                component: Dish
            },
            {
                name:"employee",
                path: "/employee",
                component: Employee
            },
            {
                name:"operate",
                path: "/operate",
                component: Operate
            },
            {
                name:"order",
                path: "/order",
                component:Order
            },
            {
                name:"role",
                path: "/roles",
                component: Role
            },
            {
                name: "welcome",
                path: "/welcome",
                component: Welcome
            }
        ]
      }
]

const router = new VueRouter({
  routes
})

export default router
/*
{
  path: '/about',
      name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/!* webpackChunkName: "about" *!/ '../views/About.vue')
}*/
